package org.example.excel;

import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.example.po.TestExcelPo;
import org.rcy.framework.file.excel.PoiExcelService;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.List;
import java.util.Map;

/**
 * @author 吴康桥
 * @Description
 * @date 2022/12/12 14:36
 */


public class TestExcelService {
	public static void main(String[] args) throws Exception {
		FileInputStream fis = new FileInputStream("C:\\Users\\admin\\Downloads\\1EE97940.xlsx");
		PoiExcelService poiExcelService = new PoiExcelService();
		List<Map<String, String>> maps = poiExcelService.readExcel(fis, TestExcelPo.class);
		FileOutputStream fos = new FileOutputStream("C:\\Users\\admin\\Downloads\\testWrite.xlsx");
		Workbook  workbook = new SXSSFWorkbook(500);
		Sheet fuckingTest = workbook.createSheet("fuckingTest");
		Row row = fuckingTest.createRow(0);
		row.createCell(0).setCellValue("第一列");
		row.createCell(1).setCellValue("第二列");
		poiExcelService.writeExcel(1,TestExcelPo.class,maps,fuckingTest,new TestExcelStyleCallBack());
		workbook.write(fos);

	}
}
